import { ReactElement } from 'react'
import { Form, Input, Col } from 'antd'
import { ConditionSchema } from '@components/schema/condition'
const { Item } = Form

function Main (): ReactElement {
  return (
    <Col span={8}>
      <Item label='仲裁员' name='arbitrator'>
        <Input placeholder='请输入' />
      </Item>
    </Col>
  )
}

export function initFormat (f: { [k: string]: any }, t: { [k: string]: any }): void {
  if (typeof f.arbitrator === 'string') {
    t.arbitrator = f.arbitrator
  }
}

export function changeFormat (o: { [k: string]: any }): void {

}

export function getCondition (d: { [k: string]: any }): ConditionSchema[] {
  const condition: ConditionSchema[] = []
  if (typeof d.arbitrator === 'string' && d.arbitrator.length > 0) {
    condition.push({ k: 'arbitrator', o: 'like', v: `%${d.arbitrator}%` })
  }
  return condition
}

export default {
  component: Main,
  initFormat,
  changeFormat,
  getCondition
}
